/* This file is part of Super Luigi Bros.
 * Super Luigi Bros is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * Super Luigi Bros is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with Super Luigi Bros.  If not, see <http://www.gnu.org/licenses/>.
 */
package luigibros.displayComponents;

import javax.swing.JComponent;

import java.util.List;
import java.util.concurrent.Semaphore;

import luigibros.logic.ChangeManager;
import luigibros.logic.ScreenOccupant;
import luigibros.logic.Luigi;
import luigibros.data.ImageStore;
import luigibros.displayComponents.Renderer;
import luigibros.window.GameManager;

/** This class is the main class for the display code.  All of
 *  the logic centered upon this class.  The class coordinates
 *  all of the functions that the classes it contains and manages
 *  the individual roles of the section.  It also informs Renderer
 *  when the component has been resized
 *  @author zking918@gmail.com && johnson.brian39825@gmail.com
 */
public class DisplayComponent extends JComponent
{
	public GameManager newGame;
	public ImageStore setOfImages;
	public List<ScreenOccupant> visibleOccupants;
	public ScreenOccupant occupant;
	public double beginX;
	public double beginY;
	public double endX;
	public double endY;
	volatile boolean isRunning;
	
	/** This constructor uses a parameter of GameManager and constructs a
	 *  DisplayComponent and sets the GameManager with the appropriate
	 *  method
	 *  @param game
	 *  @author zking918@gmail.com
	 */
	public DisplayComponent(GameManager game)
	{
		setGameManager(game);
	}
	
	/** This constructor uses a parameter of ImageStore and constructs a
	 *  DisplayComponent and sets the ImageStore with the appropriate method
	 *  @param imageStore
	 *  @author zking918@gmail.com
	 */
	public DisplayComponent(ImageStore imageStore)
	{
		setImageStore(imageStore);
	}
	
	/** This method returns a new interface of GameManager
	 *  @return newGame
	 *  @author zking918@gmail.com && johnson.brian39825@gmail.com
	 */
	public GameManager getGameManager()
	{
		return newGame;
	}
	
	/** This method sets a value to the newGame field
	 *  @param game
	 *  @author zking918@gmail.com && johnson.brian39825@gmail.com
	 */
	public void setGameManager(GameManager game)
	{
		newGame = game;
	}
	
	/** This method sets the value for the setOfImages fields
	 *  holding the images used in the game
	 *  @param imageStore
	 */
	public void setImageStore(ImageStore imageStore)
	{
		setOfImages = imageStore;
	}
	
	/** This method pauses the game and sets the isRunning field to false
	 *  @author zking918@gmail.com	&& johnson.brian39825@gmail.com
	 */
	public void pause()
	{
		isRunning = false;
	}
	
	/** This method starts the game and tells the components and game
	 *  to repaint
	 *  @author zking918@gmail.com	&& johnson.brian39825@gmail.com
	 */
	public void start()
	{
		isRunning = true;
		repaint();
	}
	
	/** This method handles the repainting of the window used for
	 *  Super Luigi Bros and is overriding the repaint method inherited
	 *  in JComponent
	 *  @author zking918@gmail.com && johnson.brian39825@gmail.com
	 */
	@Override
	public void repaint()
	{
			Renderer renderer = new Renderer(null);
			//renderer.drawImage(null)  could not use because method was not made.
	}
	
	
}